<template>
  <van-popup
    :show="skuVisible"
    :close-on-click-overlay="true"
    :round="true"
    position="bottom"
    custom-style="overflow-y: inherit;"
    @click-overlay="close"
  >
    <view class="popup__content">
      <view class="popup__info">
        <image class="img" src="https://img13.360buyimg.com/n1/jfs/t1/139891/37/34212/150224/6411271dF34f07316/33e41085a66c5026.jpg.avif" />
        <view class="text">
          <view class="price">￥49.00</view>
          <view style="margin-bottom: 12rpx"><text class="label">库存</text> 999件</view>
          <view><text class="label">选择</text> 颜色，大小</view>
        </view>
      </view>
      <view class="popup__tags">
        <view>颜色</view>
        <view class="box">
          <view class="item">白色</view>
          <view class="item">红色</view>
          <view class="item">黑色</view>
          <view class="item">白色+红色</view>
          <view class="item">白色+黑色</view>
        </view>
      </view>
      <view class="popup__tags">
        <view>大小</view>
        <view class="box">
          <view class="item">M码</view>
          <view class="item">XL码</view>
          <view class="item">XXL码</view>
          <view class="item">XXXL码</view>
          <view class="item">XXXXL码</view>
        </view>
      </view>
      <view class="popup__number">
        <text>购买数量</text>
        <van-stepper />
      </view>
    </view>
    <view class="fixed-btm">
      <view @tap="car" class="red">加入购物车</view>
      <view @tap="buy">立即购买</view>
    </view>
  </van-popup>
</template>

<script>
export default {
  data() {
    return {
      skuVisible: false,
    }
  },
  methods: {
    open() {
      this.skuVisible = true;
    },
    close() {
      this.skuVisible = false;
    }
  }
}
</script>

<style lang="scss">
.popup__content {
  box-sizing: border-box;
  padding-bottom: 88rpx;
  font-size: 24rpx;
  color: #333;
}
.popup__info {
  border-bottom: 2rpx solid #F5F5F5;
  box-sizing: border-box;
  padding: 0 28rpx 20rpx 28rpx;
  display: flex;
  .img {
    width: 176rpx;
    height: 176rpx;
    margin-right: 24rpx;
    border-radius: 10rpx;
    position: relative;
    top: -46rpx;
  }
  .text {
    box-sizing: border-box;
    padding-top: 38rpx;
  }
  .price {
    color: #FF2323;
    font-size: 32rpx;
    margin-bottom: 12rpx;
  }
  .label {
    color: #8E8E8E;
    margin-right: 20rpx;
  }
}
.popup__tags {
  box-sizing: border-box;
  padding: 0 28rpx;
  .box {
    display: flex;
    flex-wrap: wrap;
    margin-top: 16rpx;
  }
  .item {
    background-color: #F5F5F5;
    border: 2rpx solid #EEEEEE;
    border-radius: 6rpx;
    height: 58rpx;
    box-sizing: border-box;
    padding: 0 12rpx;
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    margin-right: 24rpx;
    margin-bottom: 24rpx;
    color: #666;
  }
}
.popup__number {
  width: 100%;
  height: 88rpx;
  border-top: 2rpx solid #F5F5F5;
  border-bottom: 2rpx solid #F5F5F5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding: 0 28rpx;
}
.fixed-btm {
  width: 100%;
  box-sizing: content-box;
  background-color: #fff;
  display: flex;
  position: static !important;
  > view {
    flex: 1;
    height: 88rpx;
    background-color: #FBBF0D;
    color: #fff;
    font-size: 30rpx;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    &.red {
      background-color: #FB740D;
    }
  }
}
</style>
